import request from '@/utils/request'

// 示例接口
export function login(data: { jobNumber :string; password: string }) {
  return request({
    url: '/login', // 实际请求路径为 localhost:8080/login
    method: 'post',
    data
  })
}
// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

// 更新用户信息
export const updateUserInfo = (data: { name: string; phone: string }) => {
  return request({
    url: '/user/info',
    method: 'put',
    data
  })
}

// 修改密码
export const updatePassword = (data: { oldPassword: string; newPassword: string }) => {
  return request({
    url: '/user/password',
    method: 'put',
    data
  })
}

export const getUserInspectionHistory = (data:any) => {
  return request({
    url: '/Inspection/historyList',
    method: 'post',
    data
  })
}
export const getUserWarningHistory = (data:any) => {
  return request({
    url: '/warning/historyList',
    method: 'post',
    data
  })
}
export const getUserRepairHistory = (data:any) => {
  return request({
    url: '/repair/historyList',
    method: 'post',
    data
  })
}

export const updateUserRepair = (data:any) => {
  return request({
    url: '/repair/updateRepair',
    method: 'post',
    data
  })
}
export const updateUserWarning = (data:any) => {
  return request({
    url: '/warning/updateWarning',
    method: 'post',
    data
  })
}
export const updateInspection = (data:any) => {
  return request({
    url: '/Inspection/updateInspection',
    method: 'post',
    data
  })
}